package Classic150;

public class 删除有序数组中的重复项 {
    /*
        考虑返回元素顺序，顺序双指针
     */
    public int removeDuplicates(int[] nums) {
        int left = 0, right = 1;
        while (right < nums.length) {
            if (nums[right] != nums[left]) nums[++left] = nums[right];
            right++;
        }
        return left + 1;
    }
}
